package com.design.pattern.structure.adapter.demol.passport.adapterv1;

public   class PasswordForThirdAdapter extends PassportService implements IPassword4Third {

    public ResultMsg loginForQQ(String openId) {
        return loginForRegist(openId, null);
    }

    @Override
    public ResultMsg loginForWechat(String openId) {
        return loginForRegist(openId, null);
    }

    @Override
    public ResultMsg loginForToken(String token) {
        return loginForRegist(token, null);
    }

    @Override
    public ResultMsg loginForTelphone(String phone) {
        return loginForRegist(phone, null);
    }
    private ResultMsg loginForRegist(String username, String password){
        if(null == password) {
            password = "EMPTY";
        }
        super.regist(username, password);
        return super.login(username, password);
    }
}
